feat: new experimental gc friendly flatten cache#712
Open
Conversation
5f5d6b5 to
8520080
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
8520080 to
b2d37ed
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
82a112a to
c0e7210
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
c0e7210 to
35822ea
Compare
Signed-off-by: Rueian <rueiancsie@gmail.com>
…Update Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Signed-off-by: Rueian <rueiancsie@gmail.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
Introduces a new experimental GC-friendly flatten cache implementation by adding a time.Time parameter to the Update method signature across the caching system. This change enables better temporal tracking and supports the implementation of a new chained cache structure with improved memory management.
Key changes:
- Updated
Updatemethod signature to includetime.Timeparameter - Added new cache data structures in
internal/cachepackage with optimized memory layout - Implemented
NewChainedCacheas an experimental alternative to the default cache
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pipe_test.go | Updated test calls to include time parameter in cache Update method |
| pipe.go | Modified cache Update calls to pass current time |
| lru_test.go | Updated all test cases to use new Update method signature |
| lru.go | Added time parameter to Update method (parameter is unused) |
| internal/cache/lru_test.go | Added comprehensive tests for new LRU double map implementation |
| internal/cache/lru.go | Implemented new LRU double map with GC-friendly design |
| internal/cache/double_test.go | Added tests for new double map data structure |
| internal/cache/double.go | Implemented core double map functionality |
| internal/cache/chain_test.go | Added tests for chain data structure |
| internal/cache/chain.go | Implemented linked chain for hash collision handling |
| cache_test.go | Updated test calls and added test for new flatten cache |
| cache.go | Updated Update method signature and implemented new chained cache |
Comments suppressed due to low confidence (1)
lru.go:221
- [nitpick] The parameter name
_(blank identifier) indicates the time parameter is intentionally unused. Consider using a more descriptive name likenowortimestampfor better code readability, even if the parameter is currently unused.
func (c *lru) Update(key, cmd string, value RedisMessage, _ time.Time) (pxat int64) {
| m.bp.New = func() any { | ||
| e := &empties{s: make([]string, 0, bpsize)} | ||
| runtime.SetFinalizer(e, func(e *empties) { | ||
| if len(e.s) >= 0 { |
There was a problem hiding this comment.
The condition len(e.s) >= 0 is always true since slice length is never negative. This should likely be len(e.s) > 0 to only delete when there are actually entries to process.
Suggested change
| if len(e.s) >= 0 { | |
| if len(e.s) > 0 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.